/*
 *   Copyright (c) 2011 Hitachi Data Systems, Inc.
 *
 *   Permission is hereby granted to  this software and associated
 *   documentation files (the "Software"), subject to the terms and
 *   conditions of the Sample Source Code License (SSCL) delivered
 *   with this Software. If you do not agree to the terms and
 *   conditions of the SSCL,
 *
 *     (i)  you must close this file and delete all copies of the
 *          Software, and
 *     (ii) any permission to use the Software is expressly denied.
 *
 */

package com.hds.hcp.apihelpers.query.request;

/**
 * This class defines the main container for creating the <code>queryRequest</code>
 * to be used for obtaining object metadata from the HCP system via the Metadata Query
 * Interface.
 * <p>
 * Once this object is populated with the appropriate query request data, a JSON 
 * representation of the query can be obtained and used to submit a query request to
 * the HCP system.
 * <p>
 * This class is a container that can hold the following query attributes:
 * <table border="1" cellpadding="4">
 * <tr><td>count</td><td>number of records to return</td></tr>
 * <tr><td>objectProperties</td><td>comma separated list of object properties to return in the result set</td></tr>
 * <tr><td>verbose</td><td>whether to return verbose level of detail for records</td></tr>
 * <tr><td>lastResult</td><td>starting point for next query request in the context of a Page Query</td></tr>
 * <tr><td>systemMetadata</td><td>object metadata filter to be applied to objects to be returned</td></tr>
 * </table>
 * <p>
 * The class is constructed as a Bean to facilitate utilizing Jackson JSON 
 * serializer to create JSON formatted requests. The Jackson JSON component
 * will interpret the Bean format and generate JSON string for the object when
 * calling the <code>toString</code> method.
 * <p>
 * Any values that are not explicitly set will result in no value included in the
 * JSON output string. If no values are set, it will be considered an empty query and
 * metadata for all objects on the HCP system will be returned.
 * <p>
 * If no values are set, the JSON representation of the empty query will be:
 * <pre>
 *    {}
 * </pre>
 * 
 * If only the count value is set to <code>1000</code>, the JSON representation will be:
 * <pre>
 *     {
 *         "count":1000
 *     }
 * </pre>
 * 
 * @version 5.0
 *
 */
public class Operation extends BaseQueryRequest {
	
	private Integer _count;
	private Boolean _verbose;
	private String _objectProperties;
	private LastResult _lastResult;
	private OperationQuerySystemMetadata _systemMetadata;
	
	public Operation() {};
	
	/**
	 * Alternate constructor that allows to set the object member values.
	 * @param inCount Number of records to return
	 * @param inVerbose Indicate whether the verbose form of object metadata should be returned
	 * @param inLastResult Object describing the last result record returned from another partial query.
	 * This value, if present, will direct the query engine to utilize an existing query and start at the
	 * result described with this object.
	 * @param inSystemMetadata Object describing object metadata filtering for the content to be returned.
	 */
	public Operation(Integer inCount, Boolean inVerbose, LastResult inLastResult, OperationQuerySystemMetadata inSystemMetadata) {
		_count = inCount;
		_verbose = inVerbose;
		_lastResult = inLastResult;
		_systemMetadata = inSystemMetadata;
	}

	/**
	 * Getter function for the <code>count</code> value set in this object.
	 * @return <code>null</code>, if value not set.  Otherwise, <code>Integer</code> object containing the value. 
	 */
	public Integer getCount() {
		return _count;
	}
	
	/**
	 * Getter function for the <code>objectProperty</code> value set in this object.
	 * @return <code>null</code>, if value not set.  Otherwise, <code>String</code> object containing the value. 
	 */
	public String getObjectProperties() {
		return _objectProperties;
	}
	
	/**
	 * Getter function for the <code>lastResult</code> value set in this object.
	 * @return <code>null</code>, if value is not set.  Otherwise, <code>LastResult</code> object containing the value.
	 */
	public LastResult getLastResult() {
    	return _lastResult;
    }
	
	/**
	 * Getter function for the <code>systemMetadata</code> value set in this object.
	 * @return <code>null</code>, if value is not set.  Otherwise, <code>SystemMetadata</code> object containing the value.
	 */
    public OperationQuerySystemMetadata getSystemMetadata() {
    	return _systemMetadata;
    }
    
	/**
	 * Getter function for the <code>verbose</code> value set in this object.
	 * @return <code>null</code>, if value is not set.  Otherwise, <code>Boolean</code> object containing the value.
	 */
	public Boolean getVerbose() {
		return _verbose;
	}
	
	/**
	 * Setter function for the <code>count</code> value for this object.
	 * @param inCount <code>Integer</code> for the number of records to return for query.
	 * <p>If parameter passed in is <code>null</code>, the value is considered <b><i>not</i></b> set.
	 */
	public void setCount(Integer inCount)
	{
		_count = inCount;
	}
	
	/**
	 * Setter function for the <code>objectProperties</code> value for this object.
	 * @param inProps <code>String</code> for the comma separated list of object properties to return for query.
	 * <p>If parameter passed in is <code>null</code>, the value is considered <b><i>not</i></b> set.
	 */
	public void setObjectProperties(String inProps)
	{
		_objectProperties = inProps;
	}
	
	/**
	 * Setter function for the <code>lastResult</code> member value for this object.
	 * @param inLastResult <code>LastResult</code> value for this object.
	 * <p>If parameter passed in is <code>null</code>, the value is considered <b><i>not</i></b> set.
	 */
	public void setLastResult(LastResult inLastResult)
	{
		_lastResult = inLastResult;
	}
	
	/**
	 * Setter function for the <code>systemMetadata</code> member value for this object.
	 * @param inSystemMetadata <code>SystemMetadata</code> value for this object.
	 * <p>If parameter passed in is <code>null</code>, the value is considered <b><i>not</i></b> set.
	 */
	public void setSystemMetadata(OperationQuerySystemMetadata inSystemMetadata) {
		_systemMetadata = inSystemMetadata;
	}

	/**
	 * Setter function for the <code>verbose</code> member value for this object.
	 * @param inVerbose <code>Boolean</code> value for this object.
	 * <p>If parameter passed in is <code>null</code>, the value is considered <b><i>not</i></b> set.
	 */
	public void setVerbose(Boolean inVerbose)
	{
		_verbose = inVerbose;
	}
}
